﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Progrom
{
    public partial class Students : Form
    {
        public Students()
        {
            InitializeComponent();
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void Students_Load(object sender, EventArgs e)
        {
            radioMale.Checked = true;
            cobDept.SelectedIndex = 0;
            datebirthday.MaxDate = DateTime.Now;
            datebirthday.Value = datebirthday.MinDate;
            timerGO.Enabled = true;
        }

        private void cobDept_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cobDept.SelectedIndex)
            {
                case 0:
                    lstSpec.Items.Clear();
                    lstSpec.Items.Add("计算机科学与技术");
                    lstSpec.Items.Add("信息与计算科学");
                    break;
                case 1:
                    lstSpec.Items.Clear();
                    lstSpec.Items.Add("集成电路与集成系统");
                    lstSpec.Items.Add("集成电路设计与集成系统");
                    break;
                case 2:
                    lstSpec.Items.Clear();
                    lstSpec.Items.Add("通信工程");
                    lstSpec.Items.Add("电子信息工程");
                    lstSpec.Items.Add("电磁场与无线技术");
                    lstSpec.Items.Add("机械设计制造与自动化");
                    break;
                case 3:
                    lstSpec.Items.Clear();
                    lstSpec.Items.Add("国际经济与贸易");
                    lstSpec.Items.Add("电子商务");
                    lstSpec.Items.Add("信息管理与信息系统");
                    lstSpec.Items.Add("财务管理");
                    break;
                default:
                    lstSpec.Items.Clear();
                    lstSpec.Items.Add("数字动画");
                    lstSpec.Items.Add("影视动画");
                    lstSpec.Items.Add("数字媒体");
                    lstSpec.Items.Add("平面设计");
                    break;
            }
            lstSpec.SelectedIndex=0;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sex = "";
            if (radioMale.Checked)
                sex = radioMale.Text;
            else
                sex = radioFemale.Text;
            string dept = cobDept.SelectedItem.ToString();
            string spec = lstSpec.SelectedItem.ToString();
            string hobby = "";
            if (checkBox1.Checked) hobby += checkBox1.Text;
            if (checkBox2.Checked) hobby += "、" + checkBox2.Text;
            if (checkBox3.Checked) hobby += "、" + checkBox3.Text;
            if (checkBox4.Checked) hobby += "、" + checkBox4.Text;
            string info = "您的姓名是;" + textName.Text;
            info += "\n性别为:" + sex;
            info += "\n出生年月为:" + datebirthday.Value.ToShortDateString();
            info += "\n您是" + dept + "系" + spec + "专业的学生";
            info += "\n您的兴趣有:" + hobby;
            MessageBox.Show(info, "学生信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
